From 7c0f0e882ae60911e39aaf7b42fb2d94108f3474 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 22 Dec 2015 20:45:33 -0800 Subject: [PATCH] scrolledwindow: deprecate scrollbars-within-bevel style property These days all the themes set it to TRUE, and it's not clear what happens with overlay scrollbars... --- gtk/gtkscrolledwindow.c | 92 +++--------------------- gtk/theme/Adwaita/_common.scss | 1 - gtk/theme/Adwaita/gtk-contained-dark.css | 1 - gtk/theme/Adwaita/gtk-contained.css | 1 - gtk/theme/HighContrast/_common.scss | 1 - gtk/theme/HighContrast/gtk.css | 1 - gtk/theme/win32/gtk-win32-base.css | 1 - 7 files changed, 8 insertions(+), 90 deletions(-) diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 5eaaf7f2e2..950ad3d3ad 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -601,6 +601,8 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) * Whether to place scrollbars within the scrolled window's bevel. * * Since: 2.12 + * + * Deprecated: 3.20: the value of this style property is ignored. */ gtk_widget_class_install_style_property (widget_class, g_param_spec_boolean ("scrollbars-within-bevel", @@ -2203,19 +2205,15 @@ gtk_scrolled_window_draw_scrollbars_junction (GtkScrolledWindow *scrolled_window GtkAllocation hscr_allocation, vscr_allocation; GtkStyleContext *context; GdkRectangle junction_rect; - gboolean is_rtl, scrollbars_within_bevel; + gboolean is_rtl; is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; gtk_widget_get_allocation (GTK_WIDGET (priv->hscrollbar), &hscr_allocation); gtk_widget_get_allocation (GTK_WIDGET (priv->vscrollbar), &vscr_allocation); - gtk_widget_style_get (widget, - "scrollbars-within-bevel", &scrollbars_within_bevel, - NULL); context = gtk_widget_get_style_context (widget); - if (scrollbars_within_bevel && - priv->shadow_type != GTK_SHADOW_NONE) + if (priv->shadow_type != GTK_SHADOW_NONE) { GtkStateFlags state; GtkBorder padding, border; @@ -2384,53 +2382,24 @@ gtk_scrolled_window_draw (GtkWidget *widget, { GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget); GtkScrolledWindowPrivate *priv = scrolled_window->priv; - GtkAllocation relative_allocation; GtkStyleContext *context; - gboolean scrollbars_within_bevel; if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget))) { context = gtk_widget_get_style_context (widget); - gtk_scrolled_window_relative_allocation (widget, &relative_allocation); gtk_render_background (context, cr, 0, 0, gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget)); + gtk_render_frame (context, cr, + 0, 0, + gtk_widget_get_allocated_width (widget), + gtk_widget_get_allocated_height (widget)); if (priv->hscrollbar_visible && priv->vscrollbar_visible) gtk_scrolled_window_draw_scrollbars_junction (scrolled_window, cr); - - gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); - - if (!scrollbars_within_bevel) - { - GtkStateFlags state; - GtkBorder padding, border; - - state = gtk_style_context_get_state (context); - gtk_style_context_get_padding (context, state, &padding); - gtk_style_context_get_border (context, state, &border); - - relative_allocation.x -= padding.left + border.left; - relative_allocation.y -= padding.top + border.top; - relative_allocation.width += padding.left + padding.right + border.left + border.right; - relative_allocation.height += padding.top + padding.bottom + border.top + border.bottom; - } - else - { - relative_allocation.x = 0; - relative_allocation.y = 0; - relative_allocation.width = gtk_widget_get_allocated_width (widget); - relative_allocation.height = gtk_widget_get_allocated_height (widget); - } - - gtk_render_frame (context, cr, - relative_allocation.x, - relative_allocation.y, - relative_allocation.width, - relative_allocation.height); } GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->draw (widget, cr); @@ -2745,11 +2714,7 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window, GtkAllocation child_allocation, content_allocation; GtkWidget *widget = GTK_WIDGET (scrolled_window); gint sb_spacing, sb_height, sb_width; - gboolean scrollbars_within_bevel; GtkScrolledWindowPrivate *priv; - GtkBorder padding, border; - GtkStyleContext *context; - GtkStateFlags state; priv = scrolled_window->priv; @@ -2758,13 +2723,6 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window, gtk_widget_get_preferred_height (priv->hscrollbar, &sb_height, NULL); gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL); - context = gtk_widget_get_style_context (widget); - state = gtk_style_context_get_state (context); - - gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); - gtk_style_context_get_padding (context, state, &padding); - gtk_style_context_get_border (context, state, &border); - if (scrollbar == priv->hscrollbar) { child_allocation.x = content_allocation.x; @@ -2787,21 +2745,6 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window, child_allocation.width = content_allocation.width; child_allocation.height = sb_height; - - if (priv->shadow_type != GTK_SHADOW_NONE) - { - if (!scrollbars_within_bevel) - { - child_allocation.x -= padding.left + border.left; - child_allocation.width += padding.left + padding.right + border.left + border.right; - - if (priv->window_placement == GTK_CORNER_TOP_LEFT || - priv->window_placement == GTK_CORNER_TOP_RIGHT) - child_allocation.y += padding.bottom + border.bottom; - else - child_allocation.y -= padding.top + border.top; - } - } } else if (scrollbar == priv->vscrollbar) { @@ -2828,25 +2771,6 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window, child_allocation.y = content_allocation.y; child_allocation.width = sb_width; child_allocation.height = content_allocation.height; - - if (priv->shadow_type != GTK_SHADOW_NONE) - { - if (!scrollbars_within_bevel) - { - child_allocation.y -= padding.top + border.top; - child_allocation.height += padding.top + padding.bottom + border.top + border.bottom; - - if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && - (priv->window_placement == GTK_CORNER_TOP_RIGHT || - priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) || - (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && - (priv->window_placement == GTK_CORNER_TOP_LEFT || - priv->window_placement == GTK_CORNER_BOTTOM_LEFT))) - child_allocation.x += padding.right + border.right; - else - child_allocation.x -= padding.left + border.left; - } - } } *allocation = child_allocation; diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss index 25e0d8dee9..1f94ced3c6 100644 --- a/gtk/theme/Adwaita/_common.scss +++ b/gtk/theme/Adwaita/_common.scss @@ -16,7 +16,6 @@ $asset_suffix: if($variant=='dark', '-dark', ''); // only in the width -GtkScrolledWindow-scrollbar-spacing: 0; - -GtkScrolledWindow-scrollbars-within-bevel: 1; -GtkToolItemGroup-expander-size: 11; -GtkTreeView-expander-size: 11; diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css index d209054d57..c54514649f 100644 --- a/gtk/theme/Adwaita/gtk-contained-dark.css +++ b/gtk/theme/Adwaita/gtk-contained-dark.css @@ -3,7 +3,6 @@ -GtkToolButton-icon-spacing: 4; -GtkTextView-error-underline-color: #cc0000; -GtkScrolledWindow-scrollbar-spacing: 0; - -GtkScrolledWindow-scrollbars-within-bevel: 1; -GtkToolItemGroup-expander-size: 11; -GtkTreeView-expander-size: 11; -GtkTreeView-horizontal-separator: 4; diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css index d5df390ce5..60cfc2dfbb 100644 --- a/gtk/theme/Adwaita/gtk-contained.css +++ b/gtk/theme/Adwaita/gtk-contained.css @@ -3,7 +3,6 @@ -GtkToolButton-icon-spacing: 4; -GtkTextView-error-underline-color: #cc0000; -GtkScrolledWindow-scrollbar-spacing: 0; - -GtkScrolledWindow-scrollbars-within-bevel: 1; -GtkToolItemGroup-expander-size: 11; -GtkTreeView-expander-size: 11; -GtkTreeView-horizontal-separator: 4; diff --git a/gtk/theme/HighContrast/_common.scss b/gtk/theme/HighContrast/_common.scss index 257fd82864..4dc5ce6db9 100644 --- a/gtk/theme/HighContrast/_common.scss +++ b/gtk/theme/HighContrast/_common.scss @@ -20,7 +20,6 @@ $ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94); // only in the width -GtkScrolledWindow-scrollbar-spacing: 0; - -GtkScrolledWindow-scrollbars-within-bevel: 1; -GtkToolItemGroup-expander-size: 11; -GtkExpander-expander-size: 16; diff --git a/gtk/theme/HighContrast/gtk.css b/gtk/theme/HighContrast/gtk.css index 3b6ef36932..db3a1cb38b 100644 --- a/gtk/theme/HighContrast/gtk.css +++ b/gtk/theme/HighContrast/gtk.css @@ -40,7 +40,6 @@ -GtkCheckButton-indicator-size: 16; -GtkCheckMenuItem-indicator-size: 16; -GtkScrolledWindow-scrollbar-spacing: 0; - -GtkScrolledWindow-scrollbars-within-bevel: 1; -GtkToolItemGroup-expander-size: 11; -GtkExpander-expander-size: 16; -GtkTreeView-horizontal-separator: 4; diff --git a/gtk/theme/win32/gtk-win32-base.css b/gtk/theme/win32/gtk-win32-base.css index cac37877f1..350d6a1b06 100644 --- a/gtk/theme/win32/gtk-win32-base.css +++ b/gtk/theme/win32/gtk-win32-base.css @@ -31,7 +31,6 @@ GtkViewport { -GtkWidget-visited-link-color: -gtk-win32-color(button, 26); border-color: shade (@bg_color, 0.6); - -GtkScrolledWindow-scrollbars-within-bevel: 1; -GtkScrolledWindow-scrollbars-spacing: 0; } -- 2.30.2